<?php

namespace app\controllers\api;

use api\models\custom\Identity;
use app\models\UserLog;
use Yii;
use yii\base\Exception;
use yii\base\UserException;
use yii\helpers\Json;
use yii\web\Controller;
use yii\web\Response;

class BaseController extends \app\controllers\BaseController {
    public $enableCsrfValidation = false;

    public function renderSuccess($params = []) {
        Yii::$app->response->format = Response::FORMAT_JSON;
        return [
            'state' => 0,
            'message' => '',
            'data' => $params,
        ];
    }
    public function renderError($message, $params = []) {
        Yii::$app->response->format = Response::FORMAT_JSON;
        return [
            'state' => 600,
            'message' => $message,
            'data' => $params,
        ];
    }
}
